package com.hd.sup.modules.alarm.wrapper;

import com.hd.common.constant.BizConstant;
import com.hd.common.page.BaseControllerWrapper;
import com.hd.common.utils.DateUtil;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;

/**
 * @author chentl
 * @version V1.0
 * @Project 交通运输第三方监测平台
 * @Title AlarmWrapper.java
 * @Description 报警装饰器
 * @Package com.hd.sup.modules.alarm.wrapper
 * @date 2020/12/31 2:48 下午
 * @Copyright: 深圳市宏电技术股份有限公司 All rights reserved.
 */
public class AlarmWrapper extends BaseControllerWrapper {

    public AlarmWrapper(Object obj) {
        super(obj);
    }

    @Override
    protected void warpTheMap(Map<String, Object> map) {
        //报警开始时间
        Object start_time = map.get("start_time");
        if (start_time != null) {
            Date date = (Date) start_time;
            String dateStr = DateUtil.format(date, BizConstant.Common.DATE_FORMAT_SECOND.key());
            map.put("start_time", dateStr);
        }

        //离线时间
        Object end_time = map.get("end_time");
        if (end_time != null) {
            Date date = (Date) end_time;
            String dateStr = DateUtil.format(date, BizConstant.Common.DATE_FORMAT_SECOND.key());
            map.put("end_time", dateStr);
        }

        //创建时间
        Object create_time = map.get("create_time");
        if (create_time != null) {
            Date date = (Date) create_time;
            String dateStr = DateUtil.format(date, BizConstant.Common.DATE_FORMAT_SECOND.key());
            map.put("create_time", dateStr);
        }

    }
}